package com.dnui.seven2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dnui.seven2.entity.Comment;
import com.dnui.seven2.service.CommentService;
import com.dnui.seven2.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author fengy
 * @description 针对表【comment】的数据库操作Service实现
 * @createDate 2022-10-16 10:08:48
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment>
        implements CommentService{


    @Autowired
    private CommentMapper commentMapper;

    @Override
    public List<Comment> queryComments(Integer currentPageNum, Integer everyPage) {
        Page page=new Page(currentPageNum,everyPage);
        commentMapper.selectPage(page, null);
        return page.getRecords();
    }



    @Override
    public void deleteComment(Long commentId) {
        commentMapper.deleteById(commentId);
    }

    @Override
    public void updateComment(Comment comment) {
        commentMapper.updateById(comment);
    }
}




